package behavior.observer;
/**
 * 观察者模式
 * 
 * 被观察者状态的改变需要及时通知观察者
 * 
 * @author houkai
 *
 */
public class ObserverPatternDemo {
	public static void main(String[] args) {
		Student s1 = new Student();
		Student s2 = new Student();
		
		Teacher t = new Teacher();
		t.addStudent(s1);
		t.addStudent(s2);
		
		t.setPhone("0000");
		System.out.println("--------------");
		t.setPhone("1111");
		
	}
}
